package org.springblade.minio.feign;

import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author ZH
 */

@FeignClient(
	//定义Feign指向的service-id
	value = "blade-minio"
)
public interface MinioClient {

	/***
	 * 获取文件下载连接
	 * @param path
	 * @return
	 */
	@PostMapping("/getDownloadUrl")
	R<String> getDownloadLink(@ApiParam(value = "文件相对路径",required = true) @RequestParam String path);

	/***
	 * 上传文件
	 * @param multipartFile
	 * @param path
	 * @return
	 */
	@PostMapping("/uploadToMinio")
	R uploadToMinio(@ApiParam(value = "文件",required = true) @RequestParam MultipartFile multipartFile,
						   @ApiParam(value = "指定上传地址",required = true) @RequestParam String path);

	/***
	 * 根据前缀删除文件
	 * @param prefix
	 * @return
	 */
	@PostMapping("/deletedFileByPrefix")
	R deletedFileByPrefix(@ApiParam(value = "文件路径前缀",required = true) @RequestParam String prefix);
}
